package com.lsfb.signln;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.baidu.mapapi.SDKInitializer;
import com.lsfb.signln.Index.IndexActivity;
import com.lsfb.signln.Login.LoginActivity;
import com.lsfb.signln.Utils.URLString;
import com.zgscwjm.lsfbbasetemplate.LsfbAppManager;
import com.zgscwjm.lsfbbasetemplate.config.Config;
import com.zgscwjm.lsfbbasetemplate.internet.BaseInternet;
import com.zgscwjm.lsfbbasetemplate.utils.SPUtils;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //在使用SDK各组件之前初始化context信息，传入ApplicationContext
        //注意该方法要再setContentView方法之前实现
        SDKInitializer.initialize(getApplicationContext());
        setContentView(R.layout.activity_main);

        //第二种验证方式
        Config.TOKENTYPE = 2;
        Config.setScreen(true);
        Config.vertica = true;
        Config.Config(this);
        Config.setVERSION("v1.0");
        BaseInternet.setmContext(getApplicationContext());
        Config.ConfigBaseURL(URLString.BASE);
        Config.Style_AppColor = this.getResources().getColor(R.color.theme_color);
        LsfbAppManager.getAppManager().addActivity(this);

        String userid = (String) SPUtils.get(getApplicationContext(), "userid1", "-1");
        if (!userid.equals("-1")) {
            Config.setUserId(userid);
            startActivity(new Intent(this, IndexActivity.class));
        } else {
            startActivity(new Intent(this, LoginActivity.class));
        }


    }
}
